const db = uniCloud.database();
const _ = db.command;

export default async function getUsers(Region) {
	try {
		const {
			southwest,
			northeast
		} = Region;

		// // 1. 转换经纬度并保留精度
		// const swLng = Number(southwest.longitude);
		// const swLat = Number(southwest.latitude);
		// const neLng = Number(northeast.longitude);
		// const neLat = Number(northeast.latitude);

		// // 2. 获取真实数据的经纬度（用于对比）
		// const realData = await db.collection('opendb-poi').limit(1).get();
		// const realLng = realData.result.data[0].location.coordinates[0];
		// const realLat = realData.result.data[0].location.coordinates[1];


		// 4. 路径加单引号 + 双条件查询
		const result = await db.collection('message_public')
		.where(

			{
				'location.coordinates[0]':119.21658018118144
			})
			.get()


		// 打印最终对比
		console.log("显式$and+极端范围-结果数量：", result);

	} catch (e) {
		console.error("最终查询错误：", e);
		throw e;
	}
}